package com.lvyq.javaprint.context;

import com.lvyq.javaprint.model.PrintData;
import com.lvyq.javaprint.service.PrintService;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.InputStream;
import java.net.URL;

/**
 * @author lvyq 使用策略模式管理不同的打印服务
 * @version 1.0
 * Create by 2024-08-06 15:16
 */
public class PrintContext {
    private PrintService printService;

    public void setPrintService(PrintService printService) {
        this.printService = printService;
    }

    public void print(String content, PrintData data) {
        printService.print(content,data);
    }

    public void print(MultipartFile multipartFile, PrintData data) {
        printService.print(multipartFile,data);
    }

    public void print(URL url, PrintData data) {
        printService.print(url,data);
    }

    public void print(File file, PrintData data) {
        printService.print(file,data);
    }

    @Deprecated
    public void print(InputStream inputStream,PrintData data) {
        printService.print(inputStream,data);
    }


}
